package com.ashley.day_0607;
//顺序查找
public class ArrayTest5 {

	public static void main(String[] args) {
		int arr[] = new int[] { 12, 20, 35, 79, 66, 101, 256, 43 };
		int dest = 256;
		dest = 3;
		boolean isFlag = true;
		for (int i = 0; i < arr.length; i++) {
			if (dest == (arr[i])) {
				System.out.println("找到了指定元素，其位置为：" + i);
				isFlag = false;
				break;
			}
		}
		if (isFlag) {
			System.out.println("没有找到指定元素！");

			String arr1[] = new String[] { "春节", "元宵节", "儿童节", "国庆节" };
			String dest1 = "儿童节";
			for (int i = 0; i < arr1.length; i++) {
				if (dest1.equals(arr1[i])) {
					System.out.println("找到了指定元素，其位置为：" + i);
					isFlag = false;
					break;
				}
			}
			if (isFlag) {
				System.out.println("没有找到指定元素！");
			}
		}

	}
}
